package
{
  import spark.components.supportClasses.Skin;
  import mx.controls.Alert;
  import flash.display.Sprite;
 
  import mx.collections.ArrayCollection;
  import mx.controls.DataGrid;
  import mx.core.UIComponent;
  import mx.skins.ProgrammaticSkin;
  
  import flash.display.Graphics; 
  
  //import mx.core.mx_internal;
  //use namespace mx_internal;

  public class DataGridMy extends DataGrid
  {
    public var rowColorFunction:Function;
    public var rowColor;
   
    
    function DataGridMy(){
    		setStyle('headerBackgroundSkin', CustomDataGridHeaderBackgroundSkin); 
			setStyle('headerSeparatorSkin', ProgrammaticSkin); 
			setStyle('headerStyleName', 'headDG');  
			setStyle('verticalSeparatorSkin', LineSeparatorGrid);
			setStyle('borderVisible', false);   
			resizableColumns = false; 
			rowColor = 0xffffff;
			sortableColumns = false;
    }
   
    override protected function drawHorizontalLine(s : Sprite, rowIndex : int, color : uint, y : Number) : void{
    }
    
    override protected function drawRowBackground(s:Sprite,
        rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void
    {
    	var item:Object;
	    if(dataProvider && dataIndex < dataProvider.length)
	    {
	      item = dataProvider[dataIndex];
	    }
    	if (rowColorFunction) 
    	    color = rowColorFunction(item, rowIndex, dataIndex, color); 
    	 else
    		color = rowColor is Number ? rowColor : color;
    			
      	super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);
    }
    
    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void 
        { 
            super.updateDisplayList(unscaledWidth, unscaledHeight); 
        }  
    
   /* override mx_internal function _drawHeaderBackground(headerBG : UIComponent):void
    {
    	
      	//super.drawHeaderBackground(headerBG);
    }
    */
    
  }
}